import java.util.Arrays;
import java.util.Scanner;

public class Main1 {
	
	public static void main(String[] args) {

			Scanner sc = new Scanner(System.in);
			Scanner sk = new Scanner(System.in);
			int[] digits=null;
			
			while(true){
			String choice = sc.nextLine();
			switch (choice) {
			case "fib":
				int n = sc.nextInt();
				fib(n);
				break;
			case "sort":
				String line = sc.nextLine();
				String[] strDigits=line.split(" ");
				digits=convertToIntDigits(strDigits);
				Arrays.sort(digits);
				System.out.println(Arrays.toString(digits));
				break;
			case "search":
				int digit = Integer.parseInt(sc.nextLine());
				int pos = Arrays.binarySearch(digits, digit);
				if(pos<0)
					System.out.println(-1);
				else
					System.out.println(pos);
				break;
			case "getBirthDate":
				int x = Integer.parseInt(sc.nextLine());
				for (int i=0;i<x;i++){
					String id = sc.nextLine();
					System.out.println(getBirthDate(id));
				}
				break;
			case "e":
				System.out.println("exit");
				break;
			}

		}
	}



		private static String getBirthDate(String id) {
			String year = id.substring(6, 10);
			String month = id.substring(10, 12);
			String date = id.substring(12, 14);
		return year+"-"+month+"-"+date;
	}



		private static int[] convertToIntDigits(String[] strDigits) {
			int lenth=strDigits.length;
			int []digite = new int[lenth];
			int i=0;
			while(i<strDigits.length){
				digite[i]=Integer.parseInt(strDigits[i]);
				i++;
			}		
		return digite;
	}



		private static void fib(int n) {
			int i=2;
			int [] num= new int[n+1];
			num[0]=1;
			num[1]=1;
			while(i<n){
				num[i]=num[i-1]+num[i-2];
				i++;
				}	
			for(int j=0;j<n;j++){
				System.out.print(num[j]);
				System.out.print(" ");
			}
			System.out.println();
		}

	}


